package plp.funcoo.dec.classes;

import plp.funcoo.dec.parameter.ParameterList;
import plp.funcoo.environment.execution.ExecutionEnvironment;
import plp.funcoo.exceptions.ClassAlreadyDeclared;
import plp.funcoo.exceptions.ClassNotDeclared;
import plp.funcoo.exceptions.MethodAlreadDeclared;
import plp.funcoo.exceptions.MethodNotDeclared;
import plp.funcoo.exceptions.ObjectAlreadyDeclared;
import plp.funcoo.exceptions.ObjectNotDeclared;
import plp.funcoo.exceptions.VarAlreadyDeclared;
import plp.funcoo.exceptions.VarNotDeclared;
import plp.funcoo.expressions.Expression;
import plp.funcoo.expressions.Identifier;

public class ConstructorDec extends  SignatureDec{

	private Identifier className;
	public ConstructorDec(Identifier name,Identifier className,ParameterList parameters ,Expression expression)
	{
		super(name,parameters,expression);
		this.className = className;
	}
	
	public ConstructorDec(Identifier name,Identifier className ,Expression expression)
	{
		super(name,new ParameterList(),expression);
		this.className = className;
	}

	@Override
	public ExecutionEnvironment saveEnvironment(ExecutionEnvironment envi)
			throws VarAlreadyDeclared, VarNotDeclared, ClassAlreadyDeclared,
			ClassNotDeclared, ObjectAlreadyDeclared, ObjectNotDeclared {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ExecutionEnvironment evaluate(ExecutionEnvironment envi) throws VarNotDeclared, MethodNotDeclared, VarAlreadyDeclared, MethodAlreadDeclared {
		
		envi = expression.evaluate(envi);
		return envi;
	}

	@Override
	public Declaration makeCopy() {
		
		return new ConstructorDec((Identifier)name.makeCopy(), (Identifier)className.makeCopy(), parameters.makeCopy(), expression.makeCopy());
	}
	


}
